package com.cy.test;

class Solution {

    public static void main(String[] args) {
        int i = new Solution().totalMoney(21);
        System.out.println(i);
    }

    public int totalMoney(int n) {
        int weeks = n / 7;
        int days = n % 7;
        int sum = 28;
        return sum * weeks + 7 * (Math.max((weeks - 1), 0)) + (1 + days) * days / 2 + days * weeks;

    }
}